package xfuzzy.xfghl.test.view;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import xfuzzy.xfghl.view.GeneticDataGraphPanel;

import javax.swing.JButton;

@SuppressWarnings("serial")
public class MyGraphPanel2View extends JFrame {

	private JPanel contentPane;
	private GeneticDataGraphPanel dataPanel;
	private JButton btnValue;

	/**
	 * Create the frame.
	 */
	public MyGraphPanel2View() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 1020, 420);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		dataPanel = new GeneticDataGraphPanel();
		dataPanel.setBounds(12, 12, 811, 366);
		dataPanel.update(400);
		contentPane.add(dataPanel);
		
		btnValue = new JButton("Value");
		btnValue.setBounds(835, 12, 117, 25);
		btnValue.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent arg0) {

				Random rnd = new Random();
				double value = rnd.nextDouble();
				dataPanel.addStatus(value);
				System.out.println(value);
			}
		});
		contentPane.add(btnValue);
	}
}
